package com.lxj.test_default_websocket.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;

/**
 * @author Administrator
 */
@Configuration
public class WebsocketDefaultConfig implements WebSocketConfigurer {
    @Override
    public void registerWebSocketHandlers(WebSocketHandlerRegistry webSocketHandlerRegistry) {
        webSocketHandlerRegistry.addHandler(myhandler(), "/user").setAllowedOrigins("*");
    }

    @Bean
    public Myhandler myhandler() {
        return new Myhandler();
    }
}
